﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThietBiSo.LinQDB;

namespace ThietBiSo.Models
{
    public class MFooter
    {
        private _24hmuaonlineDataContext context = new _24hmuaonlineDataContext();
        public string FindAll()
        {
            var v = from f in context.Footers select f.NoiDung;

            return v.FirstOrDefault();
        }

        public void Save(Footer bv)
        {
            context.Footers.InsertOnSubmit(bv);
            context.SubmitChanges();
        }
        public void Update(Footer bv)
        {
            var v = from f in context.Footers
                    select f;
            Footer bvdb = v.SingleOrDefault(d => d.Id.Equals(bv.Id));
            
            bvdb.NoiDung = bv.NoiDung;
            context.SubmitChanges();
        }
        //public Footer GetByID(int id)
        //{
        //    return (FindAll().Where(d => d.Id == id)).SingleOrDefault();
        //}
    }
}